package com.eastedu.converter;

import com.eastedu.model.ktree.ChapterNodeMapVO;
import com.eastedu.repository.ktree.po.ChapterNodeMapPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

import java.util.List;

/**
 * The interface Basic resource file converter.
 *
 * @author zhangzhishuai
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface ChapterNodeMapConverter {

    /**
     * Vo 2 po chapter node map po.
     *
     * @param chapterNodeMapVo the chapter node map vo
     * @return the chapter node map po
     */
    @Mapping(target = "updateUserId", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "createUserId", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "available", ignore = true)
    @Mapping(target = "mainTreeNodeId", expression = "java(chapterNodeMapVo.getMainTreeNodeId().toLowerCase())")
    @Mapping(target = "nodeId", expression = "java(chapterNodeMapVo.getNodeId().toLowerCase())")
    ChapterNodeMapPO vo2po(ChapterNodeMapVO chapterNodeMapVo);

    /**
     * Vo 2 po list.
     *
     * @param chapterNodeMapVoList the chapter node map vo list
     * @return the list
     */
    List<ChapterNodeMapPO> vo2po(List<ChapterNodeMapVO> chapterNodeMapVoList);
}
